#include "Duration.h"

#include <string.h>
#include <fan-llvm/core/Core.h>
#include "Type.h"
#include "UnsupportedErr.h"


Type* Duration_classType = NULL;
VTable* Duration_classVTable = NULL;


/**********************************************
 *
 * Methods and fields
 *
 **********************************************/


/* Bool equals(Obj? obj) */
Bool Duration_equals(Obj self, NullableObj obj)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Duration.equals not implemented yet"));
}


/* Int compare(Obj obj) */
Int Duration_compare(Obj self, Obj obj)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Duration.compare not implemented yet"));
}


/* Int hash() */
Int Duration_hash(Obj self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Duration.hash not implemented yet"));
}


/* Str toStr() */
Str* Duration_toStr(Obj self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Duration.toStr not implemented yet"));
}


/* Duration defVal */
Duration* Duration_defVal(void)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Duration.defVal not implemented yet"));
}


/* Duration minVal */
Duration* Duration_minVal(void)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Duration.minVal not implemented yet"));
}


/* Duration maxVal */
Duration* Duration_maxVal(void)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Duration.maxVal not implemented yet"));
}


/* Duration now() */
Duration* Duration_now(void)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Duration.now not implemented yet"));
}


/* Int nowTicks() */
Int Duration_nowTicks(void)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Duration.nowTicks not implemented yet"));
}


/* Duration make(Int ticks) */
Duration* Duration_make(Int ticks)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Duration.make not implemented yet"));
}


/* Duration? fromStr(Str s, Bool checked) */
Duration* Duration_fromStr_1(Str* s)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Duration.fromStr not implemented yet"));
}


/* Duration? fromStr(Str s, Bool checked) */
Duration* Duration_fromStr(Str* s, Bool checked)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Duration.fromStr not implemented yet"));
}


/* Duration boot() */
Duration* Duration_boot(void)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Duration.boot not implemented yet"));
}


/* Duration uptime() */
Duration* Duration_uptime(void)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Duration.uptime not implemented yet"));
}


/* Int ticks() */
Int Duration_ticks(Duration* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Duration.ticks not implemented yet"));
}


/* Duration negate() */
Duration* Duration_negate(Duration* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Duration.negate not implemented yet"));
}


/* Duration mult(Float b) */
Duration* Duration_mult(Duration* self, Float b)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Duration.mult not implemented yet"));
}


/* Duration div(Float b) */
Duration* Duration_div(Duration* self, Float b)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Duration.div not implemented yet"));
}


/* Duration plus(Duration b) */
Duration* Duration_plus(Duration* self, Duration* b)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Duration.plus not implemented yet"));
}


/* Duration minus(Duration b) */
Duration* Duration_minus(Duration* self, Duration* b)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Duration.minus not implemented yet"));
}


/* Duration abs() */
Duration* Duration_abs(Duration* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Duration.abs not implemented yet"));
}


/* Duration floor(Duration accuracy) */
Duration* Duration_floor(Duration* self, Duration* accuracy)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Duration.floor not implemented yet"));
}


/* Int toMillis() */
Int Duration_toMillis(Duration* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Duration.toMillis not implemented yet"));
}


/* Int toSec() */
Int Duration_toSec(Duration* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Duration.toSec not implemented yet"));
}


/* Int toMin() */
Int Duration_toMin(Duration* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Duration.toMin not implemented yet"));
}


/* Int toHour() */
Int Duration_toHour(Duration* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Duration.toHour not implemented yet"));
}


/* Int toDay() */
Int Duration_toDay(Duration* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Duration.toDay not implemented yet"));
}


/* Str toLocale() */
Str* Duration_toLocale(Duration* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Duration.toLocale not implemented yet"));
}


/* Str toCode() */
Str* Duration_toCode(Duration* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Duration.toCode not implemented yet"));
}


/* Str toIso() */
Str* Duration_toIso(Duration* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Duration.toIso not implemented yet"));
}


/* Duration fromIso(Str s, Bool checked) */
Duration* Duration_fromIso_1(Str* s)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Duration.fromIso not implemented yet"));
}


/* Duration fromIso(Str s, Bool checked) */
Duration* Duration_fromIso(Str* s, Bool checked)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Duration.fromIso not implemented yet"));
}


/**********************************************
 *
 * Type-system functions
 *
 **********************************************/


Type* Duration_initType(void)
{
  if (Duration_classType == NULL)
  {
    Type* baseType = Obj_initType();
    VTable* vtable = Duration_initVTable();
    Type* type = Type_new("Duration", baseType, vtable, sizeof(Duration), sizeof(DurationVTable));
    Type_registerMethodImplementation(type, "abs", Duration_abs, 0);
    Type_registerMethodImplementation(type, "boot", Duration_boot, 0);
    Type_registerMethodImplementation(type, "compare", Duration_compare, 1);
    Type_registerMethodImplementation(type, "div", Duration_div, 1);
    Type_registerMethodImplementation(type, "equals", Duration_equals, 1);
    Type_registerMethodImplementation(type, "floor", Duration_floor, 1);
    Type_registerMethodImplementation(type, "fromIso", Duration_fromIso_1, 1);
    Type_registerMethodImplementation(type, "fromIso", Duration_fromIso, 2);
    Type_registerMethodImplementation(type, "fromStr", Duration_fromStr_1, 1);
    Type_registerMethodImplementation(type, "fromStr", Duration_fromStr, 2);
    Type_registerMethodImplementation(type, "hash", Duration_hash, 0);
    Type_registerMethodImplementation(type, "make", Duration_make, 1);
    Type_registerMethodImplementation(type, "minus", Duration_minus, 1);
    Type_registerMethodImplementation(type, "mult", Duration_mult, 1);
    Type_registerMethodImplementation(type, "negate", Duration_negate, 0);
    Type_registerMethodImplementation(type, "now", Duration_now, 0);
    Type_registerMethodImplementation(type, "nowTicks", Duration_nowTicks, 0);
    Type_registerMethodImplementation(type, "plus", Duration_plus, 1);
    Type_registerMethodImplementation(type, "ticks", Duration_ticks, 0);
    Type_registerMethodImplementation(type, "toCode", Duration_toCode, 0);
    Type_registerMethodImplementation(type, "toDay", Duration_toDay, 0);
    Type_registerMethodImplementation(type, "toHour", Duration_toHour, 0);
    Type_registerMethodImplementation(type, "toIso", Duration_toIso, 0);
    Type_registerMethodImplementation(type, "toLocale", Duration_toLocale, 0);
    Type_registerMethodImplementation(type, "toMillis", Duration_toMillis, 0);
    Type_registerMethodImplementation(type, "toMin", Duration_toMin, 0);
    Type_registerMethodImplementation(type, "toSec", Duration_toSec, 0);
    Type_registerMethodImplementation(type, "toStr", Duration_toStr, 0);
    Type_registerMethodImplementation(type, "uptime", Duration_uptime, 0);
    Type_registerFieldImplementation(type, "defVal", Duration_defVal, NULL);
    Type_registerFieldImplementation(type, "maxVal", Duration_maxVal, NULL);
    Type_registerFieldImplementation(type, "minVal", Duration_minVal, NULL);
    Duration_classType = type;
    Duration_initStatic();
  }
  return Duration_classType;
}


VTable* Duration_initVTable(void)
{
  if (Duration_classVTable == NULL)
  {
    VTable* vtable = memoryAlloc(sizeof(DurationVTable));
    memcpy(vtable, Obj_initVTable(), sizeof(FanObjVTable));
    ((FanObjVTable*)vtable)->compare = Duration_compare;
    ((FanObjVTable*)vtable)->equals = Duration_equals;
    ((FanObjVTable*)vtable)->hash = Duration_hash;
    ((FanObjVTable*)vtable)->toStr = Duration_toStr;
    Duration_classVTable = vtable;
  }
  return Duration_classVTable;
}


void Duration_initStatic(void)
{
}
